#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll R, C;
ll d[12][1<<12];
bool can[1<<12];
bool legal(ll s){
    s |= 1<<C;
    s <<= 1;
    s|=1;
    while (s&-s){
        ll p1 = s&-s;
        s ^= p1;
        ll p2 = s&-s;
        if(!p2) break;
        int t = log2(p2/p1);
        if(t%2 == 0) return false;
    }
    return true;
}

int main() {
    ios::sync_with_stdio(false);cin.tie(nullptr);
    while (cin >> R >> C && R && C){
        for (ll i = 0; i < 1<<C; ++i) {
            if(legal(i)) can[i] = true;
            else can[i] = false;
        }
        d[0][0] = 1;
        for (int r = 1; r <= R; ++r) {
            for (ll s=0; s<1<<C; ++s){
                d[r][s] = 0;
                for (ll ss=0; ss<1<<C; ++ss){
                    if((s&ss)==0 && can[s|ss])
                        d[r][s] += d[r-1][ss];
                }
            }
        }
        cout << d[R][0] << endl;
    }
    return 0;
}